package util;

import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author silvanei
 */
public class ImagePanel extends JPanel{
    
    private Image img;

    public ImagePanel(String img) {
        this(new ImageIcon(img).getImage());
    }

    public ImagePanel(Image img) {
        this.img = img;
    }
    
    public ImagePanel(URL url) {
        this.img = new ImageIcon(url).getImage();
    }

    public void paintComponent(Graphics g) {
        g.drawImage(img, 0, 0,getWidth(), getHeight(), this);
    }
    
}
